﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace FRL.DebtChase.Common
{

	/// <summary>
	/// Constants and enumerations used in all projects
	/// </summary>
	public static class Definitions
	{

		/////////////////////////////////////////////////////////////
		// Enumeration

		public enum eInstalmentPaymentMethod
		{
			[Description("[not set]")] 
			NotSet = 0,
			[Description("Bacs")]
			Bacs = 1,
			[Description("Cheque")]
			Cheque = 2,
			[Description("Credit Card")] 
			CreditCard = 3,
			[Description("Chaps")] 
			Chaps = 4
		}

		public enum eCommTemplateType
		{
			NotSet = 0,
			Letter = 1,
			Email = 2,
		}

		public enum eCommBodyType
		{
			NotSet = 0,
			Letter = 1,
			Email = 2,
			SMS = 3,
		}

		public enum eCommTargetType
		{
			NotSet = 0,
			Debtor = 1,
			Client = 2,
			Agent = 3,
			Solicitor = 4,
		}

		public enum eAgentType
		{
			Agent = 1,
			Solicitor = 2,
		}

		public enum eContactType
		{
			NotSet = 0,
			Agent = 1,
			Client = 2,
			Account = 3,
			Staff = 4,
		}

		public enum eContactAddressType
		{
			NotSet = 0,
			Default,
			Memo,
			Additonal
		}

		public enum eContactPointType
		{
			NotSet = 0,
			Phone = 1,
			Fax = 2,
			Mobile = 3,
			DDI = 4,
			Email = 5
		}

		public enum eContactPointStatus
		{
			NotSet,
			Active,
			Dead,
		}

		public enum eDataField
		{

			NotSet = 0,

			[Description("Contact Name")]
			Contact_Name,

			[Description("Contact Notes")]
			Contact_Notes,

			[Description("Contact Number")]
			Contact_Point,

			[Description("Contact Address")]
			Contact_Address,

			[Description("Contact Bank Account")]
			Contact_BankAccount,

			[Description("Client Sales Person")]
			Client_SalesPerson,

			[Description("Client Team Group")]
			Client_TeamGroup,

			[Description("Client Invoice Contact")]
			Client_InvoiceContact,

			[Description("Client Comms Type")]
			Client_CommsType,

			[Description("Client Comms Frequency")]
			Client_CommsFrequency,

			[Description("Client Comms Contact")]
			Client_CommsContact,

			[Description("Client Comms Contact cc (A)")]
			Client_CommsContactCCA,

			[Description("Client Comms Contact cc (B)")]
			Client_CommsContactCCB,

			[Description("Client Holiday Contact")]
			Client_HolidayContact

		}

		/////////////////////////////////////////////////////////////////
		// Enumerations - Client Specific

		public enum eClientInvoicingFrequency
		{
			[Description("[not set]")]
			NotSet = 0,
			[Description("Case By Case")]
			CaseByCase = 1,
			[Description("Daily")]
			Daily = 2,
			[Description("Weekly")]
			Weekly = 3,
			[Description("Bi-Weekly")]
			BiWeekly = 4,
			[Description("Monthly")]
			Monthly = 5
		}

		public enum eClientStatementFrequency
		{
			[Description("[not set]")]
			NotSet = 0,
			[Description("Weekly")]
			Weekly = 1,
			[Description("Monthly")]
			Monthly = 2,
			[Description("Quartely")]
			Quarterly = 3
		}

		[Flags]
		public enum eClientInvoiceStatementTravel
		{
			NotSet = 0,
			Post = 0x01,
			Email = 0x02
		}

		public enum eClientFundsSettings
		{
			[Description("[not set]")]
			NotSet = 0,
			[Description("Deduct Fees")]
			DeductFees = 1,
			[Description("Pay No Deducations")]
			PayNoDeductions = 2,
			[Description("Hold")]
			Hold = 3
		}

		public enum eClientFundsFrequency
		{
			[Description("[not set]")]
			NotSet = 0,
			[Description("Weekly")]
			Weekly = 1,
			[Description("Monthly")]
			Monthly = 2
		}

		public enum eClientPaymentMethod
		{
			[Description("[not set]")]
			NotSet = 0,
			[Description("Bacs")]
			Bacs = 1,
			[Description("Cheque")]
			Cheque = 2
		}

		public enum eClientAccountStatus
		{
			[Description("[not set]")]
			NotSet = 0,
			[Description("Alive")]
			Live = 1,
			[Description("System Hold")]
			SystemHold = 2,
			[Description("Account Stop")]
			FinanceStop = 3
		}

		[Flags]
		public enum eClientCommsType
		{
			NotSet = 0x00,
			Post = 0x01,
			Email = 0x02,
			Telephone = 0x04,
		}

		[Flags]
		public enum eClientCommsFrequency
		{
			[Description("[not set]")]
			NotSet = 0,
			[Description("Weekly")]
			Weekly = 1,
			[Description("Monthly")]
			Monthly = 2,
			[Description("Quartely")]
			Quarterly = 3
		}

		[Flags]
		public enum eClientStatsEmailFrequency
		{
			[Description("[not set]")]
			NotSet = 0,
			[Description("Weekly")]
			Weekly = 1,
			[Description("Biweekly")]
			Biweekly = 2,
			[Description("Monthly")]
			Monthly = 3
		}

		[Flags]
		public enum eClientStatsType
		{
			[Description("[not set]")]
			NotSet = 0,
			[Description("Group")]
			Group = 1,
			[Description("Individual")]
			Individual = 2,
			[Description("Group + Individual")]
			GroupAndIndividual = 3
		}

		/////////////////////////////////////////////////////////////////
		// Enumerations - Roles

		[Flags]
		public enum eRoles
		{

			NotSet = 0x0,

			FIN_SYSADMIN = 0x01,
			FIN_MNGADMIN = 0x02,
			FIN_SUPERUSER = 0x04,
			FIN_USERADMIN = 0x08,
			FIN_USER = 0x10,
			FIN_SALES = 0x20,

			CLIENT_ADMIN = 0x100,
			CLIENT_USER = 0x200,

			DEBTOR = 0x1000,

		}

		public const eRoles AnyFinUserRole = eRoles.FIN_SYSADMIN | eRoles.FIN_MNGADMIN | eRoles.FIN_SUPERUSER | eRoles.FIN_USERADMIN | eRoles.FIN_USER | eRoles.FIN_SALES;
		public const eRoles AllFinExceptUserAndSales = eRoles.FIN_SYSADMIN | eRoles.FIN_MNGADMIN | eRoles.FIN_SUPERUSER | eRoles.FIN_USERADMIN;
		public const eRoles AllFinExceptSalesAndSysAdmin = eRoles.FIN_MNGADMIN | eRoles.FIN_SUPERUSER | eRoles.FIN_USERADMIN | eRoles.FIN_USER;
		public const eRoles AnyClientUserRole = eRoles.CLIENT_ADMIN | eRoles.CLIENT_USER;

		/////////////////////////////////////////////////////////////
		// Constants

		public static string All = "[all]";
		public static string None = "[none]";
		public static string Default = "[default]";
		public static string Immediate = "[immediate]";
		public static string NotSet = "[not set]";

		public static string NewTabHeading = "*New*";

		public static string Unnamed = "[no name]";

		public static string SeeErrorLog = "An error report has been sent to the website administrator.";

		public static string InternalError = "This function has caused an internal error.  An error report has been sent to the website administrator.";

		public static string DevelopmentMessage = "This feature is currently under development.";

		public static string NotKnown = "[not known]";

		public static string NotAssigned = "[not assigned]";

		public static string NotValidated = "[not validated]";

		public static char[] CommaAsCharArray = new char[1] { ',' };

		public static int MaxSMSLength = 158;

		public const int MinUsernameLength = 6;
		public const int MinPasswordLength = 6;

		public static string ReusableString_PhoneCallReasons = "PhoneCallReason";
		public static string ReusableString_PhoneCallMessages = "PhoneCallMessage";
		public static string ReusableString_ContactTitles = "ContactTitles";
		public static string ReusableString_ContactPositions = "ContactPositions";
		public static string ReusableString_ContactCounties = "ContactCounties";
		public static string ReusableString_BankNames = "BankNames";

		public static string ShortDateFormat = "dd-MMM-yyyy";

		public static string TimestampFormat = "dd-MMM-yyyy HH:mm";

		/////////////////////////////////////////////////////////////
		// Static helper functions

		public static bool Contains(Definitions.eRoles rolesA, Definitions.eRoles rolesB)
		{

			// check mask
			return ((rolesA & rolesB) != 0);

		}

	}

}
